package com.project.service;

import com.project.dao.SysInfoMapper;
import com.project.entity.SysInfo;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: TateBrown
 * @date: 2018/5/26 15:08
 * @param:
 * @return:
 */
@Transactional(rollbackFor = Exception.class)
@Service
public class SysInfoServiceImpl extends BaseService implements SysInfoService {
    @Autowired
    private  SysInfoMapper sysInfoMapper;
    @Override
    public SysInfo findById(int id) {
        return sysInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public int modifyOneById(SysInfo sysInfo) {
        return sysInfoMapper.updateByPrimaryKeySelective(sysInfo);
    }

    @Override
    public int addOne(SysInfo sysInfo) {
        return sysInfoMapper.insertSelective(sysInfo);
    }

    @Override
    public int removeOneById(Integer id) {
        return sysInfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<SysInfo> findAll() {
        return sysInfoMapper.selectAll();
    }

    /**
     * author: WheelChen
     * date: 2017/11/3
     * function: 根据属性名查找
     *
     * @param propertyName 属性名
     * @return
     */
    @Override
    public SysInfo findOneByPropertyName(String propertyName) {
        return sysInfoMapper.selectOneByPropertyName(propertyName);
    }

    /**
     * author: WheelChen
     * date: 2017/11/4
     * function: 根据属性名修改单条记录
     *
     * @param sysInfo
     * @return
     */
    @Override
    public int modifyOneByPropertyName(SysInfo sysInfo) {
        return sysInfoMapper.updateOneByPropertyName(sysInfo);
    }

    /**
     * author: WheelChen
     * date: 2017/11/8
     * function: 根据条件批量查找
     *
     * @param sysInfo
     * @return
     */
    @Override
    public List<SysInfo> findBatchByCondition(SysInfo sysInfo) {
        return sysInfoMapper.selectBatchByCondition(sysInfo);
    }
}
